package pw.archipelag.loaderGame.panel {
	import flash.display.Sprite;
	import pw.archipelag.loaderGame.interfaceGame.skinsPanel.SkinBg;

	public class PanelAbstractBg extends Sprite {
		
		internal static const MARGIN_X_ELEMENTS: Number = 30;
		internal static const MARGIN_Y_ELEMENTS: Number = 20;
		
		private var bg: Bg;
		
		public function PanelAbstractBg(isPanelMiniStartEndGame: uint) {
			this.createBg(isPanelMiniStartEndGame);
		}
		
		private function createBg(isPanelMiniStartEndGame: uint): void {
			this.bg = new Bg(isPanelMiniStartEndGame);
			this.addChild(this.bg);
		}
		
		private function removeBg(): void {
			this.removeChild(this.bg);
			this.bg = null;
		}
		
		protected function drawToBg(skinBg: SkinBg): void {
			this.bg.draw(skinBg);
		}
		
		override public function get width(): Number {
			return this.bg.width;
		}
		
		override public function get height(): Number {
			return this.bg.height;
		}
		
		override public function set width(value: Number): void {
			this.bg.width = value;
		}
		
		override public function set height(value: Number): void {
			this.bg.height = value;
		}
		
		public function destroy(): void {
			this.removeBg();
		}
		
	}

}